Skip to content

Add record codec for key-value maps#6

Merged
bavulapati merged 1 commit into
mainfrom
record-codec
Jul 10, 2026
Merged

Add record codec for key-value maps#6
bavulapati merged 1 commit into
mainfrom
record-codec

Conversation

@bavulapati

Copy link
Copy Markdown
Contributor

Adds a record(key_codec, value_codec) primitive: a uint entry-count prefix followed by each key then value encoded in insertion order, byte-for-byte compatible with JS compact-encoding's exports.record. Iterates dict.items() (insertion order, matching JS Object.keys for ordinary string keys); decode rebuilds a fresh dict in wire order. No size guard (JS record has none, unlike array).

Runtime layer for encoding top-level record types; a later hyperschema-python change will emit c.record(...) for them.

Additive: no existing codec is touched. Re-exported from __init__.py. 245 tests pass (record byte-exact + order + roundtrip), ruff clean.

@bavulapati bavulapati requested a review from a team July 10, 2026 14:07
@bavulapati bavulapati merged commit 858cbb3 into main Jul 10, 2026
8 checks passed
@bavulapati bavulapati deleted the record-codec branch July 10, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants